// 行动详情-任务状态
export default {
  initOptions: {
    grid: {
      top: 0,
      bottom: 0
    },
    series: [{
      name: '',
      type: 'pie',
      avoidLabelOverlap: false,
      center: ['50%', '50%'],
      radius: [0, '80%'],
      data: [],
      emphasis: {
        scale: true,
        scaleSize: 0
      },
      label: {
        formatter: '{b}: {c}'
      },
      labelLine: {
        length: 2,
        length2: 50,
        maxSurfaceAngle: 80
      }
    }]
  },
  setEchart (echartObject, result) {
    echartObject.setOption(this.initOptions)
    const sortResult = JSON.parse(JSON.stringify(result))
    const seriesResult = []
    for (let i = 0; i < sortResult.length; i++) {
      seriesResult.push({
        value: sortResult[i].value,
        name: sortResult[i].name,
        itemStyle: {
          color: sortResult[i].color
        }
      })
    }
    echartObject.setOption({
      series: [{
        name: '',
        data: seriesResult
      }]
    })
    setTimeout(() => {
      echartObject.resize()
    })
  }
}
